home *** CD-ROM | disk | FTP | other *** search
/ MacTech 1 to 12 / MacTech-vol-1-12.toast / Source / MacTech® Magazine / Volume 11 - 1995 / 11.04 Apr 95 / Performance / Fractal 7 / Fractal.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-11-13  |  2.4 KB  |  107 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        Fractal.h
  3.  
  4.     Used to build:    “Fractal 7”
  5.     
  6.     Written by:        Jim Cathey            July 1985
  7.                     Eric Traut            November 1994
  8.  
  9.     Description:
  10.         See comments in the file “FractalMain.c” for more
  11.         information.
  12. */
  13.  
  14. #include <QDOffscreen.h>
  15.  
  16. /* Menu information */
  17. enum {
  18.     kMenuBarID            = 128,
  19.     kAppleMenuID        = 128,
  20.     kAboutBoxItem        = 1,
  21.     kFileMenuID            = 129,
  22.     kNewFractalItem        = 1,
  23.     kQuitItem            = 3,
  24.     kEditMenuID            = 130,
  25.     kOptionsMenuID        = 131,
  26.     kSetupItem            = 1,
  27.     kContinuousItem        = 3
  28. };
  29.  
  30. /* Window, dialog, and alert constants */
  31. enum {
  32.     kMainWindowID            = 260,
  33.     kAboutBox1DialogID        = 256,
  34.     kAboutBoxOKButtonID        = 1,
  35.     kAboutBoxMoreButtonID    = 2,
  36.     kAboutBox2DialogID        = 257,
  37.     kFatalErrorAlertID        = 128
  38. };
  39.  
  40. /* Setup dialog constants */
  41. enum {
  42.     kSetUpDialogID            = 258,
  43.     kSetUpOKButtonID        = 1,
  44.     kSetUpCancelButtonID    = 2,
  45.     kSetUpLevelID            = 4,
  46.     kSetUpMtnButtonID        = 5,
  47.     kSetUpHillsButtonID        = 6,
  48.     kSetUpWaterButtonID        = 7
  49. };
  50.  
  51. /* Style and level constants */
  52. enum {
  53.     kStyleMountains            = kSetUpMtnButtonID,
  54.     kStyleHills                = kSetUpHillsButtonID,
  55.     kStyleWater                = kSetUpWaterButtonID,
  56.     kMaxLevel                = 7,
  57.     kDefaultStyle            = kStyleWater,
  58.     kDefaultLevel            = 6
  59. };
  60.  
  61. enum {
  62.     kMaxXPoint                = ((1 << kMaxLevel) + 1),
  63.     kMaxYPoint                = ((1 << (kMaxLevel - 1)) + 1)
  64. };
  65.  
  66. /* Screen constants */
  67. enum {
  68.     kNewScreenX                = 630,
  69.     kNewScreenY                = 434,
  70.     kScaleShift                = 5,
  71.     kScreenBoundaryBits        = 5,
  72.     kWindowTitleHeight        = 16
  73. };
  74.  
  75. enum {
  76.     kXOrigin                = 40,
  77.     kYOrigin                = 108,
  78.     kYMountainOrigin        = 330
  79. };
  80.  
  81. /* Types used in fractal */
  82. struct ThreePoint {
  83.     short        x;
  84.     short        y;
  85.     short        z;
  86. };
  87. typedef struct ThreePoint ThreePoint;
  88.  
  89. /* Global variables used in multiple files */
  90. extern short (*gPointArray)[kMaxXPoint][kMaxYPoint];
  91.                                             /* The array of points to be subdivided. */
  92. extern ThreePoint (*gPlotPointArray)[2 * kMaxXPoint][2 * kMaxYPoint];        
  93.                                             /* The array of points to be subdivided */
  94. extern short gContourType;                    /* Contour type */
  95. extern short gContourLevel;                    /* Level of detail */
  96. extern long gMicrosecondCount;                /* Total time spent calculating and drawing */
  97. extern long gTotalFractals;                    /* Total fractal count */
  98. extern Boolean gFractalChanged;                /* Should this screen update be counted? */
  99. extern GWorldPtr gOffscreenGWorld;            /* GWorld for faster drawing */
  100. extern PixMapHandle    gOffscreenPixMap;        /* Offscreen PixMap */
  101. extern WindowPtr gMainWindow;                /* Our one window */
  102.  
  103. void CalcSurface(unsigned short level);
  104. void PlotData(void);
  105.  
  106.  
  107.